﻿@model Freshome.p.Models.Recipe
@{
    ViewBag.Title = Model.Entity.Name + " | 食锦";
}
<h1>
    <span>@Model.Entity.Name 制作与评价</span>
</h1>
<div id="dish" class="recipeer">
    <div class="small leftie centered">
        @{
            TempData["ImageData" + Model.Entity.Mid.ToString()] = Model.Entity.ImageData;
            TempData["ImageType" + Model.Entity.Mid.ToString()] = Model.Entity.ImageType;
        }
        <img alt="@Model.Entity.Name 图片" src="@Url.Action("Imaget", "Home", new { id = @Model.Entity.Mid })" class="x2" />
    </div>
    <div class="large rightie">
        <h3>@Model.Entity.Name</h3>
        <p>@Model.Entity.Notes</p>
        <p>
            适用季节：
            @if (Model.Entity.Spring)
            { <span>春</span> }
            @if (Model.Entity.Summer)
            { <span>夏</span> }
            @if (Model.Entity.Autumn)
            { <span>秋</span> }
            @if (Model.Entity.Winter)
            { <span>冬</span> }
        </p>
    </div>
</div>
<div class="boxed clearleft">
    <h3>
        做法</h3>
    <div>
        <ol>
            @foreach (var p in Model.Entity.Steps)
            {
                <li>@p.Notes</li>
            }
        </ol>
    </div>
</div>
<div class="clearleft">
    <div class="boxed small leftie">
        <h3>
            参与评论(1 - 50个字）
        </h3>
        <div>
            <span>验证码</span>
            <div id="captchauth">@Html.Action("Captchauth")</div>
            @Ajax.ActionLink("换一个", "Index", new { id = Model.Entity.Mid },
            new AjaxOptions
            {
                UpdateTargetId = "captchauth",
                Url = Url.Action("Captchauth")
            }, new { @class = "b2y", title = "换验证码" })
        </div>
        @using (Html.BeginForm("Index", "Dish"))
        {
            @Html.ValidationSummary()
            @Html.EditorFor(model => model.Comment)
            @Html.HiddenFor(model => model.Entity.Mid)
            @Html.HiddenFor(model => model.Entity.Name)
            @Html.HiddenFor(model => model.Entity.Notes)
            <div>
                <div class="leftie">
                    <span>输入验证码：</span>@Html.EditorFor(model => model.Captcha)
                </div>
                <input type="submit" value="添加" class="rightie" />
            </div>
        }
    </div>
    <div class="boxed large rightie">
        <h3>
            最新评论</h3>
        <div>
            @foreach (var p in Model.Entity.Comments.OrderByDescending(c => c.Datime))
            {
                <div>
                    <span class="datime">
                        @p.Datime.ToString("M月d日 HH:mm")
                    </span><span>
                        @p.Notes
                    </span>
                </div>
            }</div>
    </div>
</div>
@section asidetail
{
    @if (Model.Entity.Majors.Count > 0)
    {
        <div class="boxed">
            <h3>
                主料</h3>
            <div>
                @foreach (var p in Model.Entity.Majors)
                {
                    <span>
                        @p.Parentitle</span> if (p.Notes != null && p.Notes.Length > 0)
                                             { <span>，</span>
                    <span>@p.Notes</span> } <span>；</span>
                }
                <ul class="star">
                    @foreach (var p in Model.Entity.Majors)
                    {
                        <li><strong>@p.Parentitle：</strong>@p.Stamp</li>
                    }
                </ul>
            </div>
        </div>
    }
    @if (Model.Entity.Minors.Count > 0)
    {
        <div class="boxed">
            <h3>
                佐料</h3>
            <div>
                @foreach (var p in Model.Entity.Minors)
                {
                    <span>
                        @p.Parentitle</span>
                    if (p.Notes != null && p.Notes.Length > 0)
                    {
                    <span>，</span>
                    <span>@p.Notes</span>
                    }
                    <span>；</span>
                }
                <ul class="star">
                    @foreach (var p in Model.Entity.Minors)
                    {
                        <li><strong>@p.Parentitle：</strong>@p.Stamp</li>
                    }
                </ul>
            </div>
        </div>
    }
}
